<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>chunk_analyzer 模块评估报告 - a2fad2</title>
  <style>
    body { font-family: Arial, sans-serif; line-height: 1.6; margin: 0; padding: 20px; color: #333; }
    h1, h2, h3 { color: #2c3e50; }
    .container { max-width: 1200px; margin: 0 auto; }
    .card { background: #fff; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-bottom: 20px; padding: 20px; }
    .success { color: #27ae60; }
    .error { color: #e74c3c; }
    .info { color: #3498db; }
    table { width: 100%; border-collapse: collapse; margin: 10px 0; }
    th, td { text-align: left; padding: 12px; border-bottom: 1px solid #eee; }
    th { background-color: #f8f9fa; }
    tr:hover { background-color: #f5f5f5; }
    pre { background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto; }
    .progress-container { width: 100%; background-color: #f1f1f1; border-radius: 5px; }
    .progress-bar { height: 20px; border-radius: 5px; }
    .success-bg { background-color: #4CAF50; }
    .pending-bg { background-color: #2196F3; }
    .error-bg { background-color: #f44336; }
    .tag { display: inline-block; padding: 3px 8px; border-radius: 3px; font-size: 12px; font-weight: bold; }
    .tag-success { background-color: #e8f5e9; color: #2e7d32; }
    .tag-error { background-color: #ffebee; color: #c62828; }
    .tag-pending { background-color: #e3f2fd; color: #1565c0; }
  </style>
</head>
<body>
  <div class="container">
    <h1>chunk_analyzer 模块评估报告</h1>
    
    <div class="card">
      <h2>基本信息</h2>
      <table>
        <tr>
          <td width="150"><strong>模块名称</strong></td>
          <td>chunk_analyzer</td>
        </tr>
        <tr>
          <td><strong>模块类型</strong></td>
          <td>ModuleType.CHUNK_ANALYZER</td>
        </tr>
        <tr>
          <td><strong>提交SHA</strong></td>
          <td>a2fad248947d702ed3dcb52b8377c1a3ae201e44</td>
        </tr>
        <tr>
          <td><strong>目标版本</strong></td>
          <td>linux-6.12.y</td>
        </tr>
        <tr>
          <td><strong>执行时间</strong></td>
          <td>2025-03-27T18:17:25.456564</td>
        </tr>
        <tr>
          <td><strong>状态</strong></td>
          <td>
            <span class="tag tag-success">成功</span>
          </td>
        </tr>
      </table>
    </div>
    
    <div class="card">
      <h2>输入信息</h2>
      <table>
        
                <tr>
                  <td width="200"><strong>原始补丁路径</strong></td>
                  <td>/home/elpsy/workspace/sow/patch-backport/workspace/gregkh/linux/a2fad2/patches/upstream_a2fad2.patch</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>代码仓库路径</strong></td>
                  <td>../backport-test/linux</td>
                </tr>
                
      </table>
    </div>
    
    <div class="card">
      <h2>输出信息</h2>
      <table>
        
                <tr>
                  <td width="200"><strong>状态</strong></td>
                  <td>成功</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>成功次数</strong></td>
                  <td>1</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>总尝试次数</strong></td>
                  <td>1</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>执行时间</strong></td>
                  <td>9.855758</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>总块数</strong></td>
                  <td>1</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>成功应用块数</strong></td>
                  <td>1</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>成功率</strong></td>
                  <td>100.00%</td>
                </tr>
                
                <tr>
                  <td width="200"><strong>剩余补丁路径</strong></td>
                  <td>None</td>
                </tr>
                
      </table>
    </div>
    
    
        <div class="card">
          <h2>补丁块应用统计</h2>
          
          <div class="progress-container">
            <div class="progress-bar success-bg" style="width: 100.0%"></div>
          </div>
          <p>
            成功应用 <strong class="success">1</strong> 个块，
            总共 <strong>1</strong> 个块
            (成功率: <strong>100.0%</strong>)
          </p>
        </div>
        
            <div class="card">
              <h2>应用成功的补丁块</h2>
              <table>
                <tr>
                  <th>块索引</th>
                  <th>修改文件</th>
                  <th>修改位置</th>
                  <th>补丁类型</th>
                  <th>操作</th>
                </tr>
                
                <tr>
                  <td>1</td>
                  <td>drivers/bluetooth/btqca.c</td>
                  <td>909-909</td>
                  <td></td>
                  <td>
                    <button class="view-button" onclick="showPatchDetail(1)">查看</button>
                  </td>
                </tr>
                
              </table>
            </div>
            
            <!-- 补丁详情弹窗 -->
            <div id="patch-modal" class="modal">
              <div class="modal-content">
                <span class="close-button" onclick="closePatchModal()">&times;</span>
                <h3 id="modal-title">补丁详情</h3>
                <div class="patch-details">
                  <div class="patch-metadata">
                    <p><strong>文件:</strong> <span id="modal-file"></span></p>
                    <p><strong>位置:</strong> <span id="modal-position"></span></p>
                    <p><strong>应用方法:</strong> <span id="modal-method"></span></p>
                    <p><strong>实际行号:</strong> <span id="modal-line"></span></p>
                    <p><strong>偏移量:</strong> <span id="modal-offset"></span></p>
                    <p><strong>补丁类型:</strong> <span id="modal-type"></span></p>
                  </div>
                  <div class="code-container">
                    <pre id="modal-content" class="code-block patch-content"></pre>
                  </div>
                </div>
              </div>
            </div>
            
        <div class="card">
          <h2>补丁内容详情</h2>
          <div class="tabs">
            <div class="tab-header">
              <button class="tab-button active" onclick="openTab(event, 'original-patch')">原始补丁</button>
              <button class="tab-button" onclick="openTab(event, 'applied-patches')">应用成功的补丁</button>
              <button class="tab-button" onclick="openTab(event, 'remaining-patch')">未应用成功的补丁</button>
            </div>
            
            <div id="original-patch" class="tab-content" style="display:block;">
              <h3>原始补丁内容</h3>
              <div class="code-container">
                <pre class="code-block patch-content">From a2fad248947d702ed3dcb52b8377c1a3ae201e44 Mon Sep 17 00:00:00 2001
From: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Date: Mon, 13 Jan 2025 22:43:23 +0800
Subject: [PATCH] Bluetooth: qca: Fix poor RF performance for WCN6855

For WCN6855, board ID specific NVM needs to be downloaded once board ID
is available, but the default NVM is always downloaded currently.

The wrong NVM causes poor RF performance, and effects user experience
for several types of laptop with WCN6855 on the market.

Fix by downloading board ID specific NVM if board ID is available.

Fixes: 095327fede00 (&quot;Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6855&quot;)
Cc: stable@vger.kernel.org # 6.4
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Tested-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Reviewed-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Tested-by: Steev Klimaszewski &lt;steev@kali.org&gt; #Thinkpad X13s
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
---
 drivers/bluetooth/btqca.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index a6b53d1f23dbd..cdf09d9a9ad27 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -909,8 +909,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 				 &quot;qca/msnv%02x.bin&quot;, rom_ver);
 			break;
 		case QCA_WCN6855:
-			snprintf(config.fwname, sizeof(config.fwname),
-				 &quot;qca/hpnv%02x.bin&quot;, rom_ver);
+			qca_read_fw_board_id(hdev, &amp;boardid);
+			qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
+						  &quot;hpnv&quot;, soc_type, ver, rom_ver, boardid);
 			break;
 		case QCA_WCN7850:
 			qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
</pre>
              </div>
            </div>
            
            <div id="applied-patches" class="tab-content">
              <h3>应用成功的补丁内容</h3>
              <div class="code-container">
                <pre class="code-block patch-content">

# ===== 应用成功的补丁块 1 =====
# 修改文件: drivers/bluetooth/btqca.c
# 应用位置: 909-909

From a2fad248947d702ed3dcb52b8377c1a3ae201e44 Mon Sep 17 00:00:00 2001
From: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Date: Mon, 13 Jan 2025 22:43:23 +0800
Subject: [PATCH] Bluetooth: qca: Fix poor RF performance for WCN6855

For WCN6855, board ID specific NVM needs to be downloaded once board ID
is available, but the default NVM is always downloaded currently.

The wrong NVM causes poor RF performance, and effects user experience
for several types of laptop with WCN6855 on the market.

Fix by downloading board ID specific NVM if board ID is available.

Fixes: 095327fede00 (&quot;Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6855&quot;)
Cc: stable@vger.kernel.org # 6.4
Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Tested-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Reviewed-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Tested-by: Steev Klimaszewski &lt;steev@kali.org&gt; #Thinkpad X13s
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
---
 drivers/bluetooth/btqca.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index a6b53d1f23dbd..cdf09d9a9ad27 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -909,8 +909,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 				 &quot;qca/msnv%02x.bin&quot;, rom_ver);
 			break;
 		case QCA_WCN6855:
-			snprintf(config.fwname, sizeof(config.fwname),
-				 &quot;qca/hpnv%02x.bin&quot;, rom_ver);
+			qca_read_fw_board_id(hdev, &amp;boardid);
+			qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
+						  &quot;hpnv&quot;, soc_type, ver, rom_ver, boardid);
 			break;
 		case QCA_WCN7850:
 			qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
</pre>
              </div>
            </div>
            
            <div id="remaining-patch" class="tab-content">
              <h3>未应用成功的补丁内容</h3>
              <div class="code-container">
                <pre class="code-block patch-content">无剩余补丁内容</pre>
              </div>
            </div>
          </div>
        </div>
        
        <style>
        .tabs {
          width: 100%;
          border-radius: 5px;
          overflow: hidden;
        }
        
        .tab-header {
          background-color: #f8f9fa;
          border-bottom: 1px solid #dee2e6;
          display: flex;
        }
        
        .tab-button {
          background-color: transparent;
          border: none;
          outline: none;
          cursor: pointer;
          padding: 10px 20px;
          font-size: 16px;
          transition: 0.3s;
          border-bottom: 2px solid transparent;
        }
        
        .tab-button:hover {
          background-color: #e9ecef;
        }
        
        .tab-button.active {
          border-bottom: 2px solid #4CAF50;
          font-weight: bold;
        }
        
        .tab-content {
          display: none;
          padding: 15px;
          background: white;
        }
        
        .code-container {
          max-height: 500px;
          overflow-y: auto;
          background-color: #f8f9fa;
          border-radius: 5px;
          border: 1px solid #eee;
        }
        
        .code-block {
          padding: 15px;
          margin: 0;
          white-space: pre-wrap;
          font-family: monospace;
          font-size: 13px;
          line-height: 1.4;
        }
        
        .patch-content {
          counter-reset: line;
        }
        
        .tag {
          display: inline-block;
          padding: 3px 8px;
          border-radius: 3px;
          font-size: 12px;
          font-weight: bold;
        }
        
        .tag-precise {
          background-color: #e8f5e9;
          color: #2e7d32;
        }
        
        .tag-specific {
          background-color: #e3f2fd;
          color: #1565c0;
        }
        
        .tag-actual {
          background-color: #fff3e0;
          color: #e65100;
        }
        
        .view-button {
          background-color: #4CAF50;
          color: white;
          border: none;
          padding: 5px 10px;
          border-radius: 3px;
          cursor: pointer;
        }
        
        .view-button:hover {
          background-color: #45a049;
        }
        
        /* 弹窗样式 */
        .modal {
          display: none;
          position: fixed;
          z-index: 1000;
          left: 0;
          top: 0;
          width: 100%;
          height: 100%;
          background-color: rgba(0,0,0,0.5);
        }
        
        .modal-content {
          background-color: #fff;
          margin: 5% auto;
          padding: 20px;
          border-radius: 5px;
          width: 80%;
          max-width: 1000px;
          max-height: 90vh;
          overflow-y: auto;
          box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }
        
        .close-button {
          color: #aaa;
          float: right;
          font-size: 28px;
          font-weight: bold;
          cursor: pointer;
        }
        
        .close-button:hover {
          color: #333;
        }
        
        .patch-metadata {
          background: #f8f9fa;
          padding: 10px 15px;
          border-radius: 5px;
          margin-bottom: 15px;
          display: grid;
          grid-template-columns: repeat(3, 1fr);
          gap: 10px;
        }
        </style>
        
        <script>
        // 补丁内容高亮处理
        document.addEventListener('DOMContentLoaded', function() {
          highlightPatchContent();
        });
        
        function highlightPatchContent() {
          const patchElements = document.querySelectorAll('.patch-content');
          patchElements.forEach(function(element) {
            let html = element.innerHTML;
            
            // 替换format-patch头部
            html = html.replace(/(From [0-9a-f]+ .*)/g, '<span style="color:#8e44ad;font-weight:bold;">$1</span>');
            html = html.replace(/(From: .*)/g, '<span style="color:#8e44ad;">$1</span>');
            html = html.replace(/(Date: .*)/g, '<span style="color:#8e44ad;">$1</span>');
            html = html.replace(/(Subject: .*)/g, '<span style="color:#8e44ad;font-weight:bold;">$1</span>');
            
            // 替换补丁元数据
            html = html.replace(/(# ={5,} .*)/g, '<span style="color:#2980b9;font-weight:bold;">$1</span>');
            html = html.replace(/(# 应用方法: .*|# 实际应用行号: .*|# 行号偏移: .*|# 目标文件: .*|# 提交哈希: .*|# 使用的补丁文件: .*)/g, 
                               '<span style="color:#16a085;">$1</span>');
            
            // 替换添加的行
            html = html.replace(/^(\+(?!\+\+).*)$/gm, '<span style="background-color:#e6ffed;color:#22863a;">$1</span>');
            
            // 替换删除的行
            html = html.replace(/^(-(?!--).*)$/gm, '<span style="background-color:#ffeef0;color:#cb2431;">$1</span>');
            
            // 替换区块头
            html = html.replace(/^(@@.*@@)(.*)$/gm, '<span style="color:#0366d6;background-color:#f1f8ff;">$1</span><span style="color:#6a737d;">$2</span>');
            
            // 替换diff头
            html = html.replace(/^(diff --git.*|index.*)/gm, '<span style="color:#6f42c1;font-weight:bold;">$1</span>');
            html = html.replace(/^(---.*|\+\+\+.*)$/gm, '<span style="color:#6f42c1;">$1</span>');
            
            element.innerHTML = html;
          });
        }
        
        // 标签页切换
        function openTab(evt, tabName) {
          var i, tabcontent, tabbuttons;
          
          // 隐藏所有标签内容
          tabcontent = document.getElementsByClassName("tab-content");
          for (i = 0; i < tabcontent.length; i++) {
            tabcontent[i].style.display = "none";
          }
          
          // 取消所有按钮的active状态
          tabbuttons = document.getElementsByClassName("tab-button");
          for (i = 0; i < tabbuttons.length; i++) {
            tabbuttons[i].className = tabbuttons[i].className.replace(" active", "");
          }
          
          // 显示选中的标签内容，并将按钮设为active
          document.getElementById(tabName).style.display = "block";
          if (evt) {
            evt.currentTarget.className += " active";
          } else {
            // 查找对应的按钮
            for (i = 0; i < tabbuttons.length; i++) {
              if (tabbuttons[i].getAttribute("onclick").includes(tabName)) {
                tabbuttons[i].className += " active";
                break;
              }
            }
          }
        }
        
        // 补丁详情弹窗
        let patchData = {applied_chunks_content};
        
        function showPatchDetail(index) {
          const patchInfo = patchData.find(p => p.index === index);
          if (!patchInfo) return;
          
          document.getElementById('modal-title').textContent = `补丁块 ${index} 详情`;
          document.getElementById('modal-file').textContent = patchInfo.file || '未知';
          document.getElementById('modal-position').textContent = patchInfo.position || '未知';
          document.getElementById('modal-method').textContent = patchInfo.method || '未知';
          document.getElementById('modal-line').textContent = patchInfo.actual_line || '未知';
          document.getElementById('modal-offset').textContent = patchInfo.offset || '无';
          
          let patchType = '原始补丁';
          if (patchInfo.patch_type === 'precise') patchType = '精确补丁';
          else if (patchInfo.patch_type === 'specific') patchType = '特定文件补丁';
          else if (patchInfo.patch_type === 'actual') patchType = '实际提交补丁';
          
          document.getElementById('modal-type').textContent = patchType;
          
          const contentElement = document.getElementById('modal-content');
          contentElement.innerHTML = patchInfo.content.replace(/</g, '&lt;').replace(/>/g, '&gt;');
          
          document.getElementById('patch-modal').style.display = 'block';
          
          // 应用语法高亮
          highlightPatchContent();
        }
        
        function closePatchModal() {
          document.getElementById('patch-modal').style.display = 'none';
        }
        
        // 点击模态框外部关闭
        window.onclick = function(event) {
          const modal = document.getElementById('patch-modal');
          if (event.target === modal) {
            modal.style.display = "none";
          }
        }
        </script>
        
    
  </div>
</body>
</html>